package com.feijia.aijingjingus;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import cn.smssdk.SMSSDK;

import static com.feijia.aijingjingus.GlobalHelper.md5;

public class Smslogin1 extends AppCompatActivity {


    private EditText etPassword;
    private EditText etConfirmPassword;
    private String Password,ConfirmPassword;

    //private EditText useryzm;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.smslogin1);

        etPassword = (EditText) findViewById(R.id.etPassword);
        etConfirmPassword = (EditText) findViewById(R.id.etConfirmPassword);

        /*useryzm = (EditText) findViewById(R.id.user_yzm);
        useryzm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                next(view);
            }
        });*/
    }


    /*public void next(View view) {
        //startActivity(new Intent("PersonalInformation"));
        startActivity(new Intent("controlCenterActivity"));

        //String number =useryzm.getText().toString();
        //SMSSDK.submitVerificationCode("86","15038707891",number);
    }*/

    public void getpassword(View view) {
        Password = etPassword.getText().toString().trim();
        Password = md5(Password);
        ConfirmPassword = etConfirmPassword.getText().toString().trim();
        ConfirmPassword = md5(ConfirmPassword);
        if(Password.isEmpty()||ConfirmPassword.isEmpty()){
            Toast.makeText(getApplicationContext(), getString(R.string.PasswordNoEmpty),
                    Toast.LENGTH_SHORT).show();
            return;
        }
        else if (Password.compareTo(ConfirmPassword)!=0) {
            Toast.makeText(getApplicationContext(), getString(R.string.PasswordMustSame),
                    Toast.LENGTH_SHORT).show();
            return;
        }
        else {
            Intent intent = new Intent();
            intent.setClass(this,controlCenterActivity.class);
            startActivity(intent);
        }
    }
}
